// import com->alibaba->druid->sql->SQLUtils;
// import com->alibaba->druid->sql->ast->*;
// import com->alibaba->druid->sql->ast->expr->SQLIdentifierExpr;
// import com->alibaba->druid->sql->ast->expr->SQLPropertyExpr;
// import com->alibaba->druid->util->FnvHash;

// import java->util->ArrayList;
// import java->util->std::list;
#pragma once

#include <string>
#include <list>

#include "../SQLObjectImpl.h"
#include "../SQLHint.h"
#include "../Object.h"
#include "../SQLPivot.h"
#include "../SQLUnpivot.h"

#include "../expr/SQLIdentifierExpr.h"
#include "../expr/SQLPropertyExpr.h"

#include "SQLTableSource.h"

class SQLTableSourceImpl : virtual public SQLObjectImpl, virtual public SQLTableSource
{
public:
  GETCALSS(SQLTableSourceImpl);
  string_ptr alias;
  SQLHint_list_ptr hints;
  SQLExpr_ptr flashback;
  long aliasHashCode64_;
  SQLPivot_ptr pivot;
  SQLUnpivot_ptr unpivot;

  SQLTableSourceImpl();

  SQLTableSourceImpl(string_ptr alias);
  SHAREDOBJECT(SQLTableSourceImpl) ;

  string_ptr getAlias();

  string_ptr getAlias2();

  void setAlias(string_ptr alias);

  int getHintsSize();

  SQLHint_list_ptr getHints();

  void setHints(SQLHint_list_ptr hints);

  // SQLTableSource_ptr clone();
  virtual SQLObject_ptr clone();
  string_ptr computeAlias();

  SQLExpr_ptr getFlashback();

  void setFlashback(SQLExpr_ptr flashback);

  BOOL_ptr containsAlias(string_ptr alias);

  long aliasHashCode64();

  SQLColumnDefinition_ptr findColumn(string_ptr  columnName) override;
  SQLColumnDefinition_ptr findColumn(long columnNameHash) override;

  SQLObject_ptr resolveColum(long columnNameHash);

  SQLTableSource_ptr findTableSourceWithColumn(string_ptr columnName);
  SQLTableSource_ptr findTableSourceWithColumn(SQLName_ptr columnName);
  SQLTableSource_ptr findTableSourceWithColumn(long columnNameHash);
  SQLTableSource_ptr findTableSourceWithColumn(long columnNameHash, string_ptr columnName, int option);
  SQLTableSource_ptr findTableSource(string_ptr alias);
  SQLTableSource_ptr findTableSource(long alias_hash);

  bool equals(Object_ptr o);

  int hashCode();

  SQLPivot_ptr getPivot();

  void setPivot(SQLPivot_ptr x) override;

  SQLUnpivot_ptr getUnpivot();

  void setUnpivot(SQLUnpivot_ptr x) override;
};
